<?php if(! defined('BASEPATH')) exit('No direct script access allowed');

Class Home extends My_Controller{
	public function __construct()
	{
		parent::__construct();
		//Do your magic here
		$this->load->model('m_home');
	}

	public function index()
	{
		$data['tamu'] = $this->m_home->tamu();
		$data['items'] = $this->m_home->home();
		$this->render('t_index','home/index',$data);
	}

	public function kontak()
	{
		$this->render('t_index','kontak/index');
	}

	public function facilities()
	{
		$this->data['tamu'] = $this->m_home->tamu();
		$this->data['list']=$this->m_home->facilities();
		$this->render('t_index','facilities/index',$this->data);
	}

	public function facilities_id($id=null)
	{
		$this->data['tamu'] = $this->m_home->tamu();
		$this->data['list']=$this->m_home->id_facilities($id);
		$this->load->view('facilities/detail', $this->data, FALSE);
	}

	public function gallery()
	{
		$this->data['tamu'] = $this->m_home->tamu();
		$this->data['item']=$this->m_home->gallery();
		$this->render('t_index','gallery/index',$this->data);
	}

	public function add()
	{
		if ($this->input->server('REQUEST_METHOD') === 'POST') 
		{
			$item = $this->input->post('pesan');
			$data = array(  'tgl' =>$item['tgl'],
								      'name'=>$item['name'],
								      'email'=>$item['email'],
								      'message'=>$item['message'] 
								      );
			var_dump($data);
			$this->m_home->add($data);
			header('Location: home');
		}
	}


} //end class
